
import 'package:fyi/common/common_map.dart';
import 'package:fyi/common/constant.dart';
import 'package:fyi/utils/common_util.dart';
import 'package:fyi/utils/sp_util.dart';

class HttpHeader{

  static String token;
  static String language;

  static Map<String,String> getHeader(){
    Map<String,String> map = new Map();
    map["Language"] = getLanguage();
    map["Content-Type"] = "application/json";
    map["accessToken"] = getToken();
    return map;
  }

  static String getLanguage(){
    return language ?? CommonUtil.getSelectedLocale().toString();
  }

  static String getToken(){
    return token ?? CommonMap.instance.get(Constant.TOKEN) ?? "";
  }

  static void setLanguage(String lan){
    language = lan;
  }

  static void setToken(String token){
    HttpHeader.token = token;
  }
}